Skip to content

Conversation

edgargabriel
Copy link
Member

Add support for the new MPI_Request_get_status_any/all/some functions introduced with MPI 4.1

This PR contains the C implementation for the functions as well as the man-pages.
There are however also some things missing:

  • in the C code generation python scripts, we need to introduce the ability to create const MPI_Request[], (I have currently removed the const from the function definitions in mpi.h.in in order to make the code compile).
  • Fortran interfaces

@edgargabriel edgargabriel force-pushed the topic/request-status-mult branch from d233c73 to 723b84e Compare May 26, 2025 20:46
@jsquyres jsquyres moved this to In Progress in MPI 4.1 compliance May 26, 2025
@jsquyres jsquyres marked this pull request as draft May 26, 2025 20:47
@hppritcha
Copy link
Member

Let me know if you want help with the python binding infrastructure.

@edgargabriel
Copy link
Member Author

Let me know if you want help with the python binding infrastructure.

@hppritcha yes, I would appreciate some help on that front (and the same applies for the fortran bindings, even if its just a conversation that I understand what needs to be done).

@jsquyres jsquyres added this to the v6.0.0 milestone May 27, 2025
@edgargabriel edgargabriel force-pushed the topic/request-status-mult branch 2 times, most recently from efd9cf5 to f21dff7 Compare May 27, 2025 13:32
@hppritcha
Copy link
Member

@edgargabriel added new data type to the bindings code to add this new use of const MPI_Request reqs[] in the standard.

@hppritcha
Copy link
Member

I'll work on the fortran but that will have to wait till later in the week.

@hppritcha
Copy link
Member

note that mpi4py is probably not testing this since it keys off our MPI_Get_version return values for major/minor.
@edgargabriel have you tested mpi4py with VERSION faked to return 4.1?

@edgargabriel
Copy link
Member Author

@hppritcha thank you very much, I will test it later this week. I have not done the mpi4py test that you mentioned, will look into this as well.

@edgargabriel edgargabriel force-pushed the topic/request-status-mult branch from a2aa8f9 to 81e3492 Compare June 11, 2025 21:30
@edgargabriel
Copy link
Member Author

note that mpi4py is probably not testing this since it keys off our MPI_Get_version return values for major/minor. @edgargabriel have you tested mpi4py with VERSION faked to return 4.1?

faking MPI 4.1. for mpi4py doesn't work unfortunately, we fail the compilation of mpi4py due to other missing function (MPI_Buffer_flush etc.). I will write some tests for the new functions.

@hppritcha
Copy link
Member

@edgargabriel i pushed the remainder of the fortran related files to the PR - hopefully.

@edgargabriel
Copy link
Member Author

@edgargabriel i pushed the remainder of the fortran related files to the PR - hopefully.

@hppritcha thank you! I hope to finish up adding tests to the ibm testsuite for the new function this weekend, and hopefully next week we could merge the PR if all tests pass.

@edgargabriel
Copy link
Member Author

edgargabriel commented Jun 21, 2025

I added some tests for request_get_status_any/all/some to the ompi-tests private testsuite, and they pass. This is however only testing the C-interfaces of the function. The tests are also probably not entirely bullet-proof in terms of that they might miss some corner cases, but the base function is shown to be working.

@edgargabriel edgargabriel marked this pull request as ready for review June 22, 2025 18:48
@edgargabriel edgargabriel force-pushed the topic/request-status-mult branch from 360c797 to 47fbc39 Compare July 17, 2025 14:54
@hppritcha
Copy link
Member

did we add the tests for this to ompi-tests? i'm triaging compile failures for the tests in my mtt runs:


request_get_status_all.c:32:9: error: call to undeclared function 'MPI_Request_get_status_all'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]    32 \|         MPI_Request_get_status_all(1, req, &flag, statuses);       \|         ^ request_get_status_all.c:32:9: note: did you mean 'MPI_Request_get_status'? /home/howardp/mtt/master_scratch/MiddlewareBuild_OMPIMaster/include/mpi.h:2234:20: note: 'MPI_Request_get_status' declared here  2234 \| OMPI_DECLSPEC  int MPI_Request_get_status(MPI_Request request, int *flag,       \|                    ^ 1 error generated. make[1]: Leaving directory '/home/howardp/mtt/master_scratch/TestGet_IBM/ompi-tests/ibm/pt2pt' make[1]: *** [Makefile:1582: request_get_status_all.o] Error 1 make: *** [Makefile:430: all-recursive] Error 1
--
Environment |  

@edgargabriel
Copy link
Member Author

did we add the tests for this to ompi-tests? i'm triaging compile failures for the tests in my mtt runs:


request_get_status_all.c:32:9: error: call to undeclared function 'MPI_Request_get_status_all'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]    32 \|         MPI_Request_get_status_all(1, req, &flag, statuses);       \|         ^ request_get_status_all.c:32:9: note: did you mean 'MPI_Request_get_status'? /home/howardp/mtt/master_scratch/MiddlewareBuild_OMPIMaster/include/mpi.h:2234:20: note: 'MPI_Request_get_status' declared here  2234 \| OMPI_DECLSPEC  int MPI_Request_get_status(MPI_Request request, int *flag,       \|                    ^ 1 error generated. make[1]: Leaving directory '/home/howardp/mtt/master_scratch/TestGet_IBM/ompi-tests/ibm/pt2pt' make[1]: *** [Makefile:1582: request_get_status_all.o] Error 1 make: *** [Makefile:430: all-recursive] Error 1
--
Environment |  

@hppritcha I added these tests to the ibm testsuite https://github.com/open-mpi/ompi-tests/pull/189

@edgargabriel
Copy link
Member Author

It was probably too early to merge it, should have waited until we merge the actual code. Sorry, I didn't think it through :-(

@hppritcha
Copy link
Member

related to #13279

hppritcha added a commit to hppritcha/ompi that referenced this pull request Aug 14, 2025
We only support named types with this first pass.

related to open-mpi#12076

Fortran interfaces will be added once Fortran infrastructure
additions in PR open-mpi#13279 are merged in to main.

Signed-off-by: Howard Pritchard <[email protected]>
jsquyres
jsquyres previously approved these changes Aug 15, 2025
Copy link
Member

@jsquyres jsquyres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Can we squash these down (don't have to squash to 1 commit -- just get rid of the "fixup" commits)? Then let's merge.

Copy link
Member

@bosilca bosilca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are some major issues with this PR. Please check my comments.

** MPI functions invoking this functionality does not have the const
** argument
*/
if(!ompi_request_check_same_instance((MPI_Request *)requests, count) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing ompi_request_check_same_instance to use const make sense as part of this PR because it is the first time it is useful to have const in the API instead of casting everywhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bosilca just to clarify: If I would change the ompi_request_check_same_instance function to take const MPI_Request * as an argument, I would have to add typecasts to MPI_Waitall/Waitany/Waitsome/Testall/Testany/Testsome since they are not const MPI_Request*. Is that what you are suggesting?

My line of thinking was that even if we decide to make that change (which I don't think I am technically in favor), I would prefer to do that in a separate PR, since I didn't want to touch the Waitall/Testall and friends functions in this one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure I understand why you would have to make changes anywhere else? Passing a non-const to a const function argument does not require casting (unlike passing a const to a non-const).

My concern is that delayed things have a tendency to remain delayed and then forgotten because there is always something more important. This is a general statement, I'm not pointing fingers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that is correct. I made change that you suggested, and now I get a lot of warnings from the files that I mentioned:

testall_generated.c: In function 'PMPI_Testall':
testall_generated.c:64:50: warning: passing argument 1 of 'ompi_request_check_same_instance' from incompatible pointer type [-Wincompatible-pointer-types]
   64 |             if(!ompi_request_check_same_instance(requests, count) ) {
      |                                                  ^~~~~~~~
      |                                                  |
      |                                                  struct ompi_request_t **
In file included from ../../../ompi/communicator/comm_request.h:18,
                 from ../../../ompi/communicator/communicator.h:45,
                 from testall_generated.c:33:
../../../ompi/request/request.h:575:62: note: expected 'const ompi_request_t **' but argument is of type 'struct ompi_request_t **'
  575 | bool ompi_request_check_same_instance(const ompi_request_t** requests,
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bosilca, I incorporated all of your change requests except for this const thing, can you please re-check and let me know how you would like to proceed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm puzzled by the error message as I don't see why we cannot pass a non-const argument to a const function. Anyway, as is this PR is good to go.

- add the man pages for the newly implemented MPI_Request_get_status_all/any/some functions.
- c-bindings: add support for const request args

Three new functions were added to the MPI API as part of the 4.1 standard.
These used an array of const MPI_Request s which the bindings code
didn't support.

This commit also fixes back the mpi.h prototypes to include the constants
and required changes to the new template files.

- request_get_status variants: add f08 interfaces

also switch MPI_Request_get_status to use new method for generating
f08 bindings.

- Update fortran bindings interfaces generation code.

- f90/f77 interfaces will be added as another commit.
- use-mpi-ignore: start using binding infrastructure
- request_get_status_mult: add f77 functions

Signed-off-by: Edgar Gabriel <[email protected]>
Signed-off-by: Howard Pritchard <[email protected]>
@edgargabriel edgargabriel force-pushed the topic/request-status-mult branch from 88d7f08 to b057513 Compare August 25, 2025 15:08
OMPI_COPY_STATUS(status, requests[i]->req_status, false);
}
return MPI_SUCCESS;
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The else itself is unnecessary, it can be assumed from the rest of the checks. That's how it is done in the some function.

** MPI functions invoking this functionality does not have the const
** argument
*/
if(!ompi_request_check_same_instance((MPI_Request *)requests, count) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm puzzled by the error message as I don't see why we cannot pass a non-const argument to a const function. Anyway, as is this PR is good to go.

@bosilca bosilca merged commit 59191a7 into open-mpi:main Aug 25, 2025
16 checks passed
hppritcha added a commit to hppritcha/ompi that referenced this pull request Aug 26, 2025
We only support named types with this first pass.

related to open-mpi#12076

Fortran interfaces will be added once Fortran infrastructure
additions in PR open-mpi#13279 are merged in to main.

Signed-off-by: Howard Pritchard <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

4 participants